package com.fourth.service.impl;

import com.fourth.dao.BusinessDao;
import com.fourth.service.BusinessService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ljx.entity.BusinessInfo;
import com.ljx.vo.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author C-Q
 * @version 1.1.0
 * @Description: TODO
 * @date 2023/2/27
 */
@Service
public class BusinessServiceImpl implements BusinessService {

    @Resource
    private BusinessDao businessDao;


    /**
     * 分页查询BusinessInfo商家入住审核表
     * @param currentPage： 当前页面
     * @param pageSize：每页几条
     * @return
     */
    @Override
    public Result businessAll(Integer currentPage, Integer pageSize,BusinessInfo businessInfo) {
        PageHelper.startPage(currentPage, pageSize);
        if(businessInfo.getStatus()!=null){
            List<BusinessInfo> infos = businessDao.businessDao1(businessInfo);
            PageInfo<BusinessInfo> pageInfo = new PageInfo<>(infos);
            return new Result(2000, "查询成功", pageInfo);
        }
        List<BusinessInfo> infos = businessDao.businessDao();
        PageInfo<BusinessInfo> pageInfo = new PageInfo<>(infos);
        return new Result(2000, "查询成功", pageInfo);
    }

    @Override
    public int updateInfo(BusinessInfo businessInfo) {
        int info = businessDao.updateInfo(businessInfo);
        return info;
    }

}
